<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2019/1/19s
  Time: 15:25
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title></title>
    <link rel="stylesheet" href="../../layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="../../layuiadmin/style/admin.css" media="all">
    <script src="../../js/jquery.min.3.1.0.js"></script>
</head>
<body>
<style type="text/css">
    .layui-form-item{
        margin-left: 20px;
        margin-top: 20px;
        width:600px;
    }
</style>

<form id="myform" action="/InsertEvaServlet" method="post" class="layui-form">

    <div class="layui-form-item" style="display: none">
        <div class="layui-input-block">
            <input id="wareId" name="wareId" value="${evaluate.wareId}" >
        </div>
    </div>
    <div class="layui-form-item" style="display: none">
        <div class="layui-input-block">
            <input type="hidden" id="id" name="id" value="${evaluate.evaluateId}" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">订单编号</label>
        <div class="layui-input-block">
            <input readonly type="text" id="orderId" name="orderId" lay-verify="orderId"
                   value="${order.orderId}"  placeholder="点击选择已完成订单编号" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">用户账号</label>
        <div class="layui-input-block" lay-filter="test">
            <input type="text" readonly id="account" name="img" lay-verify="account" value="${evaluate.consumerAccount}" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">商品名称</label>
        <div class="layui-input-block">
            <select name="consumerAccount" >

            </select>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">评分等级</label>
        <div class="layui-input-block">
            <select name="score" id="score">
                <option value="1" >1</option>
                <option value="2" >2</option>
                <option value="3" >3</option>
                <option value="4" >4</option>
                <option value="5" >5</option>
            </select>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">图片</label>
        <div class="layui-input-block">
            <input type="text" id="img" name="img" lay-verify="img" value="${evaluate.evaluatePhoto}" autocomplete="off" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">用户描述</label>
        <div class="layui-input-block">
            <textarea id="desc" name="desc" lay-verify="desc" autocomplete="off" class="layui-textarea">${evaluate.evaluateDescribe}</textarea>
        </div>
    </div>

    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit="" lay-filter="demo1">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>

</form>

<script src="../../layuiadmin/layui/layui.js" charset="utf-8"></script>

<script>
    layui.use(['form', 'layedit', 'laydate','jquery'], function(){
        var form = layui.form
            ,layer = layui.layer
            ,layedit = layui.layedit
            ,laydate = layui.laydate
            ,$=layui.jquery
        $("#account").bind('input propertychange',function () {
            var a=$("#txt1").val();
            console(a)

        })
        //自定义验证规则
        form.verify({
            desc:function () {
                if (!/[\u4e00-\u9fa5]+$/.test(value)) {
                    return '评论必须包含文字描述';
                }
            }
            ,account:function () {
                if (value==0) {
                    return '请选择用户';
                }
            }
        });

        //创建一个编辑器
        layedit.build('LAY_demo_editor');

        //监听提交
        form.on('submit(demo1)', function(data){
            $.ajax({
                url:"/InsertEvaServlet",    //请求的url地址
                dataType:"json",   //返回格式为json
                contentType:"application/json",
                async:true,//请求是否异步，默认为异步，这也是ajax重要特性
                data:$('#myform').serialize(),  //参数值
                type:"GET",   //请求方式
                success:function(data){
                    //请求成功时处理
                    layer.alert(data.msg, function(index) {
                        //关闭窗口
                        var index = parent.layer.getFrameIndex(window.name);
                        parent.layer.close(index);
                    })
                }
            });
            return false;
        });
    });
</script>
<script>
    $(function () {
        $("#orderId").click(function () {
            layer.open({   //打开一个弹出层
                title: '选择订单',   //弹出层的标题
                maxmin: true,
                type: 2,
                content: 'SeleOrder.jsp', //要访问的地址
                area: ['800px', '560px'],
                end: function () { //表示弹出层关闭的时候的代码块
                }
            });
        })
    })
</script>
</body>
</html>

